package com.scau.phradmin.business.healthRecord.controller;

import com.scau.phradmin.business.healthRecord.service.HealthRecordService;
import com.scau.phradmin.domain.entity.HealthRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/healthRecord")
@RestController
public class HealthRecordController {

    @Autowired
    private HealthRecordService healthRecordService;

    @GetMapping("/selectAll")
    public Object selectAll(@RequestParam("pages") int pages)
    {
        return healthRecordService.selectAll(pages);
    }

    @GetMapping("/selectById")
    public Object selectById(@RequestParam("id") Long id)
    {
        return healthRecordService.selectById(id);
    }

    @PostMapping("/edit")
    public boolean edit(HealthRecord healthRecord){
        return healthRecordService.edit(healthRecord);
    }

    @PostMapping("/add")
    public boolean add(HealthRecord healthRecord){
        return healthRecordService.add(healthRecord);
    }

    @PostMapping("/delete")
    public boolean delete(@RequestParam("id") Long id){
        return healthRecordService.delete(id);
    }
}
